home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kopete / kopeteawaydialog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  5.6 KB  |  202 lines

  1. /*
  2.     kopeteawaydialog.h  -  Kopete Away Dialog
  3.  
  4.     Copyright (c) 2002      by Hendrik vom Lehn       <hvl@linux-4-ever.de>
  5.     Copyright (c) 2003      by Martijn Klingens       <klingens@kde.org>
  6.  
  7.     Kopete    (c) 2002-2003 by the Kopete developers  <kopete-devel@kde.org>
  8.  
  9.     *************************************************************************
  10.     *                                                                       *
  11.     * This library is free software; you can redistribute it and/or         *
  12.     * modify it under the terms of the GNU Lesser General Public            *
  13.     * License as published by the Free Software Foundation; either          *
  14.     * version 2 of the License, or (at your option) any later version.      *
  15.     *                                                                       *
  16.     *************************************************************************
  17. */
  18.  
  19. #ifndef KOPETEAWAYDIALOG_H
  20. #define KOPETEAWAYDIALOG_H
  21.  
  22. #include <kdialogbase.h>
  23. #include "kopete_export.h"
  24.  
  25. namespace Kopete
  26. {
  27. class Away;
  28. }
  29.  
  30. class KopeteAwayDialogPrivate;
  31.  
  32. /**
  33.  * KopeteAwayDialog is a base class used for implementing
  34.  * Away Message selection dialogs in Kopete.  It presents
  35.  * the user with a list of pre-written away messages and
  36.  * a line edit for them to type a "single shot" away message,
  37.  * one that is not saved and will be lost the next time
  38.  * they restart the application.
  39.  *
  40.  * Individual protocols should subclass this class for protocol
  41.  * specific Away Message choosers (in the case that the user
  42.  * wants to set only one protocol away).  There are methods for
  43.  * getting the message that the user selected, as well as a
  44.  * virtual method that should be implemented that is called
  45.  * when the user selects "OK", and should be used to do
  46.  * protocol specific actions needed to set the user as
  47.  * "Away" (or whatever the protocol calls it).
  48.  *
  49.  * @author Hendrik vom Lehn <hvl@linux-4-ever.de>
  50.  * @author Christopher TenHarmsel <tenharmsel@users.sourceforge.net>
  51.  */
  52.  
  53. class KOPETE_EXPORT KopeteAwayDialog : public KDialogBase
  54. {
  55.     Q_OBJECT
  56.  
  57. public:
  58.     /**
  59.      * Constructor for the Away Dialog
  60.      * @param parent The object that owns this
  61.      * @param name Name for this object
  62.      */
  63.     KopeteAwayDialog( QWidget *parent = 0, const char *name = 0 );
  64.  
  65.     /**
  66.      * Destructor
  67.      */
  68.     virtual ~KopeteAwayDialog();
  69.  
  70. protected:
  71.     /**
  72.      * Do not delete this, this instance will
  73.      * deleted when the application closes
  74.      */
  75.     Kopete::Away *awayInstance;
  76.  
  77.     /**
  78.      * \brief Gets the last selected away message
  79.      * @return An away message
  80.      */
  81.     QString getSelectedAwayMessage();
  82.  
  83.     /**
  84.      * \brief Sets the user away
  85.      * 
  86.      * This method is called when the user clicks
  87.      * OK in the GUI, signalling that they wish
  88.      * to set the away message that they have chosen.
  89.      * Please reimplement this method to do protocol
  90.      * specific things, and use getSelectedAwayMessage()
  91.      * to get the text of the message that the user
  92.      * selected.
  93.      *
  94.      * @param awayType This is the away type specified
  95.      * if show was called with a parameter. If show() was called
  96.      * instead, this parameter will be the empty string. You
  97.      * will need to compare it to an enum that you declare
  98.      * in your subclass.
  99.      */
  100.     virtual void setAway( int awayType ) = 0;
  101.  
  102.     /**
  103.      * \brief Called when "Cancel" is clicked
  104.      *
  105.      * This method is called when the user clicks
  106.      * Cancel in the GUI, signalling that they
  107.      * canceled their request to mark themselves as
  108.      * away.  If your implementation finds this
  109.      * information useful, implement this method
  110.      * to handle this info.  By default it does nothing
  111.      *
  112.      * @param awayType This is the away type specified
  113.      * if show was called with a parameter, if show() was called
  114.      * instead, this parameter will be the empty string.
  115.      */
  116.     virtual void cancelAway( int awayType );
  117.  
  118. public slots:
  119.     /**
  120.      * \brief Shows the dialog
  121.      */
  122.     virtual void show();
  123.  
  124.     /**
  125.      * \brief Shows the dialog
  126.      *
  127.      * Shows the away dialog, but maintains a "state"
  128.      * so you can specify if you're setting away,
  129.      * do not disturb, gone, etc for protocols that
  130.      * support this like ICQ and MSN.
  131.      *
  132.      * This string does not have any special internal
  133.      * meaning, but rather will get passed to setAway()
  134.      * when it is called so that you can decide what
  135.      * kind of "away" you really want to do.
  136.      *
  137.      * @param awayType The type of "away" you want to set.
  138.      */
  139.     void show( int awayType );
  140.  
  141. protected slots:
  142.     /**
  143.      * This slot is called when the user click on "OK"
  144.      * it will call setAway(), which is pure virtual and
  145.      * should be implemented for specific needs
  146.      */
  147.     virtual void slotOk();
  148.  
  149.     /**
  150.      * This slot is called when the user clicks on
  151.      * "Cancel".  It calls cancelAway(), which is
  152.      * pure virtual and should be implemented to
  153.      * fit your specific needs if the user selects
  154.      * "Cancel".  This method will close the
  155.      * dialog, but if you require any specific actions
  156.      * please implement them in cancelAway().
  157.      */
  158.     virtual void slotCancel();
  159.  
  160. private slots:
  161.     /**
  162.      * \brief An entry was selected from the combo box
  163.      */
  164.     void slotComboBoxSelection( int index );
  165.  
  166. private:
  167.     /**
  168.      * Initializes the GUI elements every time the
  169.      * dialog is show.  Basically used for remembering
  170.      * the singleshot message that the user may have
  171.      * typed in.
  172.      */
  173.     void init();
  174.  
  175.     /**
  176.      * The last user-entered away text
  177.      * or the title of the last selected
  178.      * saved away message, whichever was
  179.      * last chosen
  180.      */
  181.     QString mLastUserAwayMessage;
  182.  
  183.     /**
  184.      * The last message that the user typed in the
  185.      * line edit
  186.      */
  187.     QString mLastUserTypedMessage;
  188.  
  189.     /**
  190.      * This is used to store the type of away that we're
  191.      * going to go.
  192.      */
  193.     int mExtendedAwayType;
  194.  
  195.     KopeteAwayDialogPrivate *d;
  196. };
  197.  
  198. #endif
  199.  
  200. // vim: set noet ts=4 sts=4 sw=4:
  201.  
  202.